#ifndef SOCKETEXCEPTIONS_HPP_
#define SOCKETEXCEPTIONS_HPP_

#include <string>
#include <sstream>
#include "exception/Exception.hpp"

namespace SystemSocket
{
	class GetAddrInfoException : public Exception::BaseException
	{
		public:
			GetAddrInfoException(int iReturnCode):
				BaseException("Function get getaddrinfo failed with code = "),_returnCode(iReturnCode){}
			virtual ~GetAddrInfoException() {}
			virtual std::string what() const
			{
				std::stringstream aMessageCreator;
				aMessageCreator << BaseException::what() << _returnCode;
				return aMessageCreator.str();
			}
		private:
			int _returnCode;
	};

	class SocketCreationException : public Exception::BaseException
	{
		public:
			SocketCreationException():
					BaseException("The socket couldn't be created."){}
			virtual ~SocketCreationException(){}
	};



	class AcceptException : public Exception::BaseException
	{
		public:
			AcceptException():BaseException("The accept method has failed."){}
			virtual ~AcceptException(){}

	};

	class ListenException : public Exception::BaseException
	{
		public:
			ListenException():BaseException("The accept method has failed."){}
			virtual ~ListenException(){}

	};

	class NonBlockingException : public Exception::BaseException
	{
		public:
			NonBlockingException():BaseException("The connection couldn't be set as non blocking."){}
			virtual ~NonBlockingException(){}

	};

	class SocketBindException : public Exception::BaseException
	{
		public:
			SocketBindException():BaseException("The socket failed on bind."){}
			virtual ~SocketBindException(){}

	};
}
#endif /* ICONNECTIONPROCESSOR_HPP_ */

